//
//  RSAUtil.h
//  Encryption
//
//  Created by 雷传营 on 16/1/10.
//  Copyright © 2016年 leichuanying. All rights reserved.
//

#import <Foundation/Foundation.h>

//这个字段需要根据具体项目修改
#define RSA_PUBLIC_KEY  @"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDrIOjc3DSZxj/Ah4jpQQEmQ92cmvp8DBG23/ReFXwSJhGCHpi+NpfP9maH/aoeS6JgkOSHsPPz8k+QD8Ga0TZE8QT9pfUgShDsC0ySczQOJjS4JmjGcYtdy31HsZ/KvobzW+RfPN0Udqc7+HgGt29SiOKUKSSX4eSaLPWpjYCwKQIDAQAB"

@interface RSAUtil : NSObject

// return base64 encoded string
+ (NSString *)encryptString:(NSString *)str publicKey:(NSString *)pubKey;
// return raw datax
+ (NSData *)encryptData:(NSData *)data publicKey:(NSString *)pubKey;
// return base64 encoded string
// enc with private key NOT working YET!
//+ (NSString *)encryptString:(NSString *)str privateKey:(NSString *)privKey;
// return raw data
//+ (NSData *)encryptData:(NSData *)data privateKey:(NSString *)privKey;

// decrypt base64 encoded string, convert result to string(not base64 encoded)
+ (NSString *)decryptString:(NSString *)str publicKey:(NSString *)pubKey;
+ (NSData *)decryptData:(NSData *)data publicKey:(NSString *)pubKey;
+ (NSString *)decryptString:(NSString *)str privateKey:(NSString *)privKey;
+ (NSData *)decryptData:(NSData *)data privateKey:(NSString *)privKey;

@end
